<extend name="Public/base"/>

<block name="body">
	<script type="text/javascript" src="__STATIC__/uploadify/jquery.uploadify.min.js"></script>
    <div class="main-title">
        <h2>修改用户</h2>
    </div>
    <form action="{:U()}" method="post" class="form-horizontal">
        <div class="form-item">
            <label class="item-label">用户名<span class="check-tips"></span></label>
            <div class="controls">
                <input type="text" class="text input-large" name="username" value="{$vo.username}">
                <input type="hidden" name="id" value="{$vo.id}" />
            </div>
        </div>

        <div class="form-item">
            <label class="item-label">昵称<span class="check-tips"></span></label>
            <div class="controls">
                <input type="text" class="text input-large" name="nickname" value="{$info.nickname}">
            </div>
        </div>
        <div class="form-item">
            <label class="item-label">邮箱<span class="check-tips">（用户邮箱，用于找回密码等安全操作）</span></label>
            <div class="controls">
                <input type="text" class="text input-large" name="email" value="{$vo.email}">
            </div>
        </div>
        <div class="form-item">
            <label class="item-label">排序<span class="check-tips">（用户排序）</span></label>
            <div class="controls">
                <input type="text" class="text input-large" name="sort" value="{$info.sort}">
            </div>
        </div>

        <div class="form-item">
            <label class="item-label">用户分组<span class="check-tips">（用户分组必须选择）</span></label>
            <div class="controls">
                <select name="group_id" style="width:200px;">
                    <volist name="gropus" id="sty">
                        <option value="{$sty.id}" <?php if($vo['group_id']==$sty[id]){echo 'selected';} ?>>{$sty.title}</option>
                    </volist>
                </select>
            </div>
        </div>
        <div class="form-item">
            <div class="controls">
                <label class="item-label">用户头像</label>
                <input type="file" id="upload_picture">
                <input type="hidden" name="icon" id="icon" value="{$info['icon']|default=''}"/>
                <div class="upload-img-box">
                <notempty name="info['icon']">
                    <div class="upload-pre-item"><img src="__ROOT__{$info.icon|get_cover='path'}"/></div>
                </notempty>
                </div>
            </div>
            <script type="text/javascript">
            //上传图片
            /* 初始化上传插件 */
            $("#upload_picture").uploadify({
                "height"          : 30,
                "swf"             : "__STATIC__/uploadify/uploadify.swf",
                "fileObjName"     : "download",
                "buttonText"      : "上传图片",
                "uploader"        : "{:U('File/uploadPicture',array('session_id'=>session_id()))}",
                "width"           : 120,
                'removeTimeout'	  : 1,
                'fileTypeExts'	  : '*.jpg; *.png; *.gif;',
                "onUploadSuccess" : uploadPicture,
                'onFallback' : function() {
                    alert('未检测到兼容版本的Flash.');
                }
            });
            function uploadPicture(file, data){
                var data = $.parseJSON(data);
                var src = '';
                if(data.status){
                    $("#icon").val(data.id);
                    src = data.url || '__ROOT__' + data.path;
                    $("#icon").parent().find('.upload-img-box').html(
                        '<div class="upload-pre-item"><img src="' + src + '"/></div>'
                    );
                } else {
                    updateAlert(data.info);
                    setTimeout(function(){
                        $('#top-alert').find('button').click();
                        $(that).removeClass('disabled').prop('disabled',false);
                    },1500);
                }
            }
            </script>
        </div>

        <div class="form-item">
            <label class="item-label">用户简介</label>
            <div class="controls">
                <label class="textarea">
                    <textarea name="content">{$info.content}</textarea>
                    {:hook('adminArticleEdit', array('name'=>content,'value'=>$info['content']))}
                </label>
            </div>
        </div>
        <div class="form-item">
            <button class="btn submit-btn" id="submit" type="submit" target-form="form-horizontal">确 定</button>
            <button class="btn btn-return" onclick="javascript:history.back(-1);return false;">返 回</button>
        </div>
    </form>
</block>

<block name="script">
    <script type="text/javascript">
        //导航高亮
        highlight_subnav('{:U('User/index')}');
    </script>
</block>
